﻿/*
 * 2012  - C.B.S. - Compute Software Solutions
 * This file is part of Observation Log.
 * 
 *     Observation Log is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 * 
 *     Observation Log is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 * 
 *     You should have received a copy of the GNU General Public License
 *     along with Observation Log.  If not, see <http://www.gnu.org/licenses/>.
 */

using System;
using System.Windows.Forms;

namespace ObservationLog
{
    public partial class frmObjectList : Form
    {
        public frmObjectList()
        {
            InitializeComponent();
        }

        private void itemsBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.itemsBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.observationLogDBDataSet);

        }

        private void ObjectList_Load(object sender, EventArgs e)
        {
            this.itemTypesTableAdapter.Fill(this.observationLogDBDataSet.ItemTypes);
            this.constellationsTableAdapter.Fill(this.observationLogDBDataSet.Constellations);
            this.itemsTableAdapter.Fill(this.observationLogDBDataSet.Items);
        }

        private void frmObjectList_FormClosed(object sender, FormClosedEventArgs e)
        {
            this.Validate();
            this.itemsBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.observationLogDBDataSet);
            this.itemsTableAdapter.Fill(this.observationLogDBDataSet.Items);
            this.DialogResult = DialogResult.OK;
        }
    }
}
